package com.auxgroup.hr.front.service.hireperson.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import com.auxgroup.hr.front.dao.domain.PsCHireFileVw;
import com.auxgroup.hr.front.dao.repository.PsCHireFileVwRepository;
import com.auxgroup.hr.front.service.hireperson.HireFileVwService;

/** 
 * @author lvliuhao
 * @version 创建时间：180523 
 * 上传文件类型service
 */
@Service("hireFileVwService")
public class HireFileVwServiceImpl implements HireFileVwService {
	private static final Logger logger = LoggerFactory.getLogger(HireEducatServiceImpl.class);
	
	@Autowired
	private PsCHireFileVwRepository PsCHireFileVwRepository;


	@Override
	public PsCHireFileVw getHireFileVw(String fileNum) {
		return PsCHireFileVwRepository.findOne(fileNum);
	}


	@Override
	public PsCHireFileVw save(PsCHireFileVw HireFileVw) {
		return PsCHireFileVwRepository.save(HireFileVw);
	}


	@Override
	public Boolean delete(String fileNum) {
		try {
			PsCHireFileVwRepository.delete(fileNum);
		} catch (Exception e) {
			logger.error("delete HireFileVw error: fileNum={}",fileNum,e);
			return false;
		}
		return true;
	}
	
	
	@Override
	public List<PsCHireFileVw> getAll() {
		return PsCHireFileVwRepository.findAll();
	}
	
	@Override
	public List<PsCHireFileVw> getAll(Boolean isHireFile) {
		PsCHireFileVw HireFileVw = new PsCHireFileVw();
		if(isHireFile){
			HireFileVw.setcYesNo1("Y");
		}
		return PsCHireFileVwRepository.findAll(Example.of(HireFileVw));
	}


	
	
	
}
